﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PacManLib
{
    /// <summary>
    /// A log broker. You can register for log events.
    /// </summary>
    public class Log
    {
        // Data passed with a log event...
        public class Args : EventArgs
        {
            public string Message { get; set; }
        }

        // You register for this event to receive logged messages...
        public static event EventHandler<Args> LogEvent;

        /// <summary>
        /// Logs a message, ie forwards it to anyone registered for
        /// the log event.
        /// </summary>
        public static void log(string message)
        {
            if (LogEvent != null)
            {
                LogEvent(null, new Args { Message = message });
            }
        }
    }
}
